﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Linq;
using SekretarDataLayer;

namespace Sekretar
{
    public partial class ZaposleniBrowse : Common.Forms.Browse
    {
        SekretarDataContext dc;

        private void RefreshGrid()
        {
            dc = new SekretarDataContext();
            bsZaposleni.DataSource = dc.Zaposlenis;
        }

        public ZaposleniBrowse()
        {
            InitializeComponent();
        }

        private void ZaposleniBrowse_Load(object sender, EventArgs e)
        {
            this.RefreshGrid();
        }

        private void btnNov_Click(object sender, EventArgs e)
        {
            ZaposleniRecView f = new ZaposleniRecView(0);
            if (f.ShowDialog() == DialogResult.OK) this.RefreshGrid();
        }

        private void btnIzmeni_Click(object sender, EventArgs e)
        {
            ZaposleniRecView f = new ZaposleniRecView(((Zaposleni)bsZaposleni.Current).ZaposleniId);
            if (f.ShowDialog() == DialogResult.OK) this.RefreshGrid();
        }
    }
}
